# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 #   * *   G a m e _ C h a r a c t e r B a s e 
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 #     T h i s   b a s e   c l a s s   h a n d l e s   c h a r a c t e r s .   I t   r e t a i n s   b a s i c   i n f o r m a t i o n ,   s u c h   a s 
 
 #   c o o r d i n a t e s   a n d   g r a p h i c s ,   s h a r e d   b y   a l l   c h a r a c t e r s . 
 
 # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 c l a s s   G a m e _ C h a r a c t e r B a s e 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   P u b l i c   I n s t a n c e   V a r i a b l e s 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     a t t r _ r e a d e r       : u n d e r _ m a p _ t i l e _ z                                                                                                                               #   U n d e r   M a p   T i l e   Z   F l a g 
 
     a t t r _ r e a d e r       : o v e r _ m a p _ t i l e _ z                                                                                                                                     #   O v e r   M a p   T i l e   Z   F l a g   
 
     a t t r _ a c c e s s o r   : c h a r a c t e r _ b i t m a p _ a r e a                                                         #   C h a r a c t e r   B i t m a p   A r e a 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   A l i a s   L i s t i n g   &   M e t h o d   D e f i n i t i o n 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   
 
     #   A l i a s   M e t h o d   L i s t 
 
     [ " i n i t _ p r i v a t e _ m e m b e r s " ,   " i n c r e a s e _ s t e p s " ,   " m o v e t o " ,   " s c r e e n _ z " ] . e a c h   { | n a m e | 
 
                                 #   A l i a s   M e t h o d 
 
                                 a l i a s _ m e t h o d   : " p v g a m e s _ u n d e r _ m a p _ t i l e _ z _ g a m e _ c h a r a c t e r b a s e _ # { n a m e } " ,   n a m e 
 
                                 #   N e x t   i f   M e t h o d s   d o n ' t   n e e d   d e f i n i t i o n 
 
                                 n e x t   i f   [ " i n i t _ p r i v a t e _ m e m b e r s " ,   " s c r e e n _ z " ] . i n c l u d e ? ( n a m e ) 
 
                                 #   D e f i n e   M e t h o d 
 
                                 d e f i n e _ m e t h o d   ( n a m e . t o _ s y m )   { | * a r g s ,   & b l o c k | 
 
                                     #   R u n   O r i g i n a l   M e t h o d 
 
                                     s e l f . s e n d   " p v g a m e s _ u n d e r _ m a p _ t i l e _ z _ g a m e _ c h a r a c t e r b a s e _ # { n a m e } " ,   * a r g s ,   & b l o c k 
 
                                     #   U p d a t e   U n d e r   M a p   T i l e   Z   F l a g 
 
                                     u p d a t e _ u n d e r _ m a p _ t i l e _ z 
 
                                   } 
 
     } 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   I n i t i a l i z e   P r i v a t e   M e m b e r   V a r i a b l e s 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     d e f   i n i t _ p r i v a t e _ m e m b e r s ( * a r g s ,   & b l o c k ) 
 
                                 #   R u n   O r i g i n a l   M e t h o d 
 
                                 p v g a m e s _ u n d e r _ m a p _ t i l e _ z _ g a m e _ c h a r a c t e r b a s e _ i n i t _ p r i v a t e _ m e m b e r s ( * a r g s ,   & b l o c k ) 
 
                                 #   S e t   U n d e r / O v e r   M a p   T i l e   Z   F l a g 
 
                                 @ u n d e r _ m a p _ t i l e _ z   =   f a l s e   ;   @ o v e r _ m a p _ t i l e _ z   =   f a l s e 
 
                                 #   S e t   C h a r a c t e r   B i t m a p   A r e a   R e c t 
 
                                 @ c h a r a c t e r _ b i t m a p _ a r e a   =   R e c t . n e w ( 0 ,   0 ,   1 ,   1 ) 
 
     e n d       
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   G e t   S c r e e n   Z - C o o r d i n a t e s 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     d e f   s c r e e n _ z ( * a r g s ,   & b l o c k ) 
 
                                 #   R e t u r n   3 0 0   i f   U n d e r / O v e r   M a p   T i l e   Z   i s   t r u e 
 
                                 r e t u r n   3 0 0   i f   u n d e r _ m a p _ t i l e _ z ?   o r   o v e r _ m a p _ t i l e _ z ? 
 
                                 #   R u n   O r i g i n a l   M e t h o d 
 
                                 p v g a m e s _ u n d e r _ m a p _ t i l e _ z _ g a m e _ c h a r a c t e r b a s e _ s c r e e n _ z ( * a r g s ,   & b l o c k ) 
 
     e n d 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   O p a c i t y 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     d e f   o p a c i t y 
 
                                 r e t u r n   @ o p a c i t y   i f   o v e r _ m a p _ t i l e _ z ? 
 
                                 r e t u r n   u n d e r _ m a p _ t i l e _ z ?   ?   1 6 0   :   @ o p a c i t y 
 
     e n d 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   D e t e r m i n e   i f   U n d e r   M a p   T i l e   Z   e f f e c t   i s   t r u e 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     d e f   u n d e r _ m a p _ t i l e _ z ?   ;   @ u n d e r _ m a p _ t i l e _ z   e n d 
 
     d e f   o v e r _ m a p _ t i l e _ z ?     ;   ( ! u n d e r _ m a p _ t i l e _ z ?   a n d   @ o v e r _ m a p _ t i l e _ z )   e n d       
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   U p d a t e   U n d e r   M a p   T i l e   Z   F l a g 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     d e f   u p d a t e _ u n d e r _ m a p _ t i l e _ z 
 
                                 #   G e t   C h a r a c t e r   A r e a   B i t m a p   R e c t 
 
                                 r e c t   =   @ c h a r a c t e r _ b i t m a p _ a r e a . d u p 
 
                                 #   I f   R e c t   W i d t h   o r   H e i g h t   i s   M o r e   t h a n   3 2 
 
                                 i f   r e c t . w i d t h   > =   3 2   o r   r e c t . h e i g h t   >   3 2 
 
                                     #   S e t   R e c t   W i d t h   a n d   H e i g h t 
 
                                     r e c t . w i d t h   =   ( r e c t . w i d t h   /   3 2 . 0 ) . r o u n d   ;   r e c t . h e i g h t   =   ( r e c t . h e i g h t   /   3 2 . 0 ) . r o u n d 
 
                                     #   S e t   R e c t   X   &   Y 
 
                                     r e c t . x   =   @ x   -   ( r e c t . w i d t h   /   2 )   ;   r e c t . y   =   @ y   -   (   r e c t . h e i g h t   /   2 ) 
 
                                     #   S e t   O v e r   M a p   T i l e   Z   t o   f a l s e 
 
                                     @ o v e r _ m a p _ t i l e _ z   =   f a l s e 
 
                                     #   M u l t i p l e   L o o p s   C a t c h 
 
                                     c a t c h ( : r a n g e )   {       
 
                                                                 #   G o   T h r o u g h   c o o r d i n a t e s 
 
                                                                 f o r   y   i n   r e c t . y . . . ( r e c t . y   +   r e c t . h e i g h t ) 
 
                                                                     f o r   x   i n   r e c t . x . . . ( r e c t . x   +   r e c t . w i d t h ) 
 
                                                                                                 #   I f   U n d e r   M a p   T i l e 
 
                                                                                                 i f   u n d e r _ m a p _ t i l e ? ( x ,   y ) 
 
                                                                                                     #   S e t   O v e r   M a p   T i l e   Z   t o   t r u e 
 
                                                                                                     @ o v e r _ m a p _ t i l e _ z   =   t r u e 
 
                                                                                                     #   B r e a k   L o o p 
 
                                                                                                     t h r o w   : r a n g e 
 
                                                                                                 e n d 
 
                                                                     e n d 
 
                                                                 e n d 
 
                                     } 
 
                                     #   G o   T h r o u g h   B o t t o m   X 
 
                                     f o r   x   i n   r e c t . x . . . ( r e c t . x   +   r e c t . w i d t h ) 
 
                                                                 #   R e t u r n   U n d e r   M a p   T i l e   Z   a s   t r u e   i f   u n d e r   m a p   t i l e 
 
                                                                 r e t u r n   @ u n d e r _ m a p _ t i l e _ z   =   t r u e   i f   u n d e r _ m a p _ t i l e ? ( x ,   @ y ) 
 
                                     e n d       
 
                                 e n d       
 
                                 #   S e t   U n d e r   M a p   T i l e   Z 
 
                                 @ u n d e r _ m a p _ t i l e _ z   =   u n d e r _ m a p _ t i l e ? 
 
     e n d 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   D e t e r m i n e   i f   C h a r a c t e r   i s   u n d e r   t i l e 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     d e f   u n d e r _ m a p _ t i l e ? ( x   =   @ x ,   y   =   @ y )   ;   $ g a m e _ m a p . o v e r _ c h a r a c t e r _ t i l e ? ( x ,   y )   e n d 
 
 e n d 
 
 
 
 # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 #   * *   G a m e _ M a p 
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 #     T h i s   c l a s s   h a n d l e s   m a p s .   I t   i n c l u d e s   s c r o l l i n g   a n d   p a s s a g e   d e t e r m i n a t i o n 
 
 #   f u n c t i o n s .   T h e   i n s t a n c e   o f   t h i s   c l a s s   i s   r e f e r e n c e d   b y   $ g a m e _ m a p . 
 
 # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 c l a s s   G a m e _ M a p 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   D e t e r m i n e   i f   T i l e   g o e s   o v e r   c h a r a c t e r   [ &] 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     d e f   o v e r _ c h a r a c t e r _ t i l e ? ( x ,   y ) 
 
                 #   R e t u r n   i f   T i l e   i s   d e f a u l t   f o r   n o t h i n g 
 
                 r e t u r n   f a l s e   i f   t i l e _ i d ( x ,   y ,   2 )   = =   0 
 
                 #   C h e c k   i f   V a l i d   t i l e   a n d   b i t   ( O v e r   C h a r a c t e r ) 
 
                 #   I n s t e a d   o f   c h e c k i n g   e v e r y t h i n g ,   j u s t   c h e c k   l a y e r   2 .   S e e m s   l i k e   
 
                 #   L a y e r   1   a r e   a u t o m a t i c a l l y   a s s i g n e d   f o r   y o u ,   w h i c h   m a y   b e   b a d 
 
                 r e t u r n   v a l i d ? ( x ,   y )   & &   t r a n s p a r e n t _ t i l e ? ( x ,   y ) 
 
     e n d 
 
 
 
     d e f   t r a n s p a r e n t _ t i l e ? ( x ,   y ) 
 
                 t i l e s e t . f l a g s [ t i l e _ i d ( x ,   y ,   2 ) ]   &   0 x 1 0   ! =   0 
 
     e n d 
 
 e n d 
 
 
 
 # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 #   * *   S p r i t e _ C h a r a c t e r 
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 #     T h i s   s p r i t e   i s   u s e d   t o   d i s p l a y   c h a r a c t e r s .   I t   o b s e r v e s   a n   i n s t a n c e   o f   t h e 
 
 #   G a m e _ C h a r a c t e r   c l a s s   a n d   a u t o m a t i c a l l y   c h a n g e s   s p r i t e   s t a t e . 
 
 # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 c l a s s   S p r i t e _ C h a r a c t e r   <   S p r i t e _ B a s e 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   A l i a s   L i s t i n g   &   M e t h o d   D e f i n i t i o n 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   
 
     #   A l i a s   M e t h o d   L i s t 
 
     [ " s e t _ t i l e _ b i t m a p " ,   " s e t _ c h a r a c t e r _ b i t m a p " ] . e a c h   { | n a m e | 
 
                                 #   A l i a s   M e t h o d 
 
                                 a l i a s _ m e t h o d   : " p v g a m e s _ u n d e r _ m a p _ t i l e _ z _ s p r i t e _ c h a r a c t e r _ # { n a m e } " ,   n a m e 
 
                                 #   D e f i n e   M e t h o d 
 
                                 d e f i n e _ m e t h o d   ( n a m e . t o _ s y m )   { | * a r g s ,   & b l o c k | 
 
                                     #   R u n   O r i g i n a l   M e t h o d 
 
                                     s e l f . s e n d   " p v g a m e s _ u n d e r _ m a p _ t i l e _ z _ s p r i t e _ c h a r a c t e r _ # { n a m e } " ,   * a r g s ,   & b l o c k 
 
                                     #   U p d a t e   C h a r a c t e r   B i t m a p   A r e a 
 
                                     u p d a t e _ c h a r a c t e r _ b i t m a p _ a r e a 
 
                                   } 
 
     } 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   U p d a t e   C h a r a c t e r   B i t m a p   A r e a 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     d e f   u p d a t e _ c h a r a c t e r _ b i t m a p _ a r e a 
 
                                 #   U p d a t e   S o u r c e   R e c t 
 
                                 u p d a t e _ s r c _ r e c t 
 
                                 #   S e t   C h a r a c t e r   B i t m a p   A r e a   R e c t 
 
                                 @ c h a r a c t e r . c h a r a c t e r _ b i t m a p _ a r e a . s e t ( 0 ,   0 ,   w i d t h ,   h e i g h t ) 
 
     e n d 
 
 e n d 
 
 
 
 
 
 # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 #   * *   G a m e _ E v e n t 
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 #     T h i s   c l a s s   h a n d l e s   e v e n t s .   F u n c t i o n s   i n c l u d e   e v e n t   p a g e   s w i t c h i n g   v i a 
 
 #   c o n d i t i o n   d e t e r m i n a n t s   a n d   r u n n i n g   p a r a l l e l   p r o c e s s   e v e n t s .   U s e d   w i t h i n   t h e 
 
 #   G a m e _ M a p   c l a s s . 
 
 # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 c l a s s   G a m e _ E v e n t   <   G a m e _ C h a r a c t e r 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
     #   *   A l i a s   L i s t i n g   &   M e t h o d   D e f i n i t i o n 
 
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   
 
     #   A l i a s   M e t h o d   L i s t 
 
     [ " r e f r e s h " ,   " c l e a r _ p a g e _ s e t t i n g s " ,   " s e t u p _ p a g e _ s e t t i n g s " ] . e a c h   { | n a m e | 
 
                                 #   A l i a s   M e t h o d 
 
                                 a l i a s _ m e t h o d   : " p v g a m e s _ u n d e r _ m a p _ t i l e _ z _ g a m e _ e v e n t _ # { n a m e } " ,   n a m e 
 
                                 #   D e f i n e   M e t h o d 
 
                                 d e f i n e _ m e t h o d   ( n a m e . t o _ s y m )   { | * a r g s ,   & b l o c k | 
 
                                     #   R u n   O r i g i n a l   M e t h o d 
 
                                     s e l f . s e n d   " p v g a m e s _ u n d e r _ m a p _ t i l e _ z _ g a m e _ e v e n t _ # { n a m e } " ,   * a r g s ,   & b l o c k 
 
                                     #   U p d a t e   U n d e r   M a p   T i l e   Z   F l a g 
 
                                     u p d a t e _ u n d e r _ m a p _ t i l e _ z 
 
                                   } 
 
     }   
 
 e n d 